message="Please input a element.\nIf you want to quit,please input 'q'"
list_0=[]

#得到列表元素
while True:
    element=input(message)
    if element=='q':
        break
    else:
        list_0.append(int(element))

#将列表排序
list_0.sort()
print(list_0)

#弹出元素
while True:
    index=input("Please input a index.\nIf you want to quit,please input 'q'")
    if index=='q':
        break
    else:
        try:
            list_0.pop(int(index))
        except IndexError:
            print(f"The {index} is not suitable ! Please input a number again !")

#输出新列表
print(list_0)

